package com.twu.biblioteca.Models;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Nimrod
 * Date: 1/25/13
 * Time: 11:19 PM
 * Contains Books
 */
public class Library {

    private List<Book> books = new ArrayList<Book>();
    private List<Movie> movies = new ArrayList<Movie>();
    private List<User> users = new ArrayList<User>();

    public void addBook(Book book) {
        this.books.add(book);
    }

    public Book getBook(String ISBN) {
        for (Book book : books) {
            if (book.getIsbn().equals(ISBN)) {
                return book;
            }
        }
        return  null;
    }

    public String reserveBook(Book book) {
        if (book != null) {
            return "Thank You! Enjoy the book.";
        }
        else {
            return  "Sorry we don't have that book yet.";
        }
    }

    public void printListOfBooksInLibrary() {
        System.out.println("List of books in the library:\n");
        for (Book book : books) {
            System.out.println(book);
        }
    }

    public void addMovie(Movie movie) {
        this.movies.add(movie);
    }

    public void printListOfMoviesInLibrary() {
        System.out.println("List of movies in the library:\n");
        for (Movie movie : movies) {
            System.out.println(movie);
        }
    }

    public void addUser (User user) {
        this.users.add(user);
    }

    public List<User> getUsers() {
        return users;
    }
}
